import axios from "../utils/axios.js";


// 获取网站基本配置信息
export const Setting = () => {
	return axios.post("/api/index/setting")
}
// 获取公告
export const NOTICE = () => {
	return axios.post("/api/index/notice")
}
// 发送登陆注册验证码
export const Login = (data) => {
	return axios.post("/api/sms/sendsms", data)
}
// 获取图形验证码
export const Yzas = (id) => {

	return axios.get(`/index.php/api/verify/captcha?id=${id}`)
}
// 获取轮播图
export const Swiper = () => {
	return axios.post("/api/index/banner")
}
// 获取搜索推荐
export const Kewords = () => {
	return axios.post("/api/index/search_kewords")
}
// 获取所有品牌列表
export const Brand = () => {
	return axios.post("/api/index/brand_list")
}
// 获取首页推荐商品
export const Page = () => {
	return axios.post("/api/index/home_page")
}
// 首页上拉加载商品
export const Update = (page) => {
	return axios.post(`/api/index/get_list?page=${page}`)
}
// 获取常见问题
export const Issue = () => {
	return axios.post("/api/event/questions")
}
// 短信登陆注册
export const Logins = (data) => {
	return axios.post(`/api/user/login`, data)
}
// 临时验证图形验证码
export const Check = (data) => {
	return axios.post("/api/verify/check", data)
}
// 获取用户基本信息
export const User = () => {
	let token = localStorage.getItem('token')
	return axios.post("/api/account/user_info")
}

// 商品
// 获取商品分类及商品
export const Classify = () => {
	return axios.post("/api/goods/classify")
}
// 获取商品详情
export const Details = (id) => {
	return axios.post("/api/goods/products_details", id)
}
// 商品搜索
export const Search = (data) => {
	return axios.post(
		`/api/goods/search?page=${data.page}&limit=${data.limit}&type=${data.type}&keyword=${data.keyword}`)
}
// 收藏
// 获取分类及商品
export const Collent = (data) => {
	return axios.post(`/api/collect/index?page=${data.page}&limit=${data.limit}`)
}
// 加入收藏
export const collectadd = (data) => {
	return axios.post(`/api/collect/add`, data)
}
//是否收藏
export const iscollect = (data) => {
	return axios.post('/api/collect/status', data)
}
// 删除收藏
export const collectdetl = (data) => {
	return axios.post("/api/collect/del", data)
}
// 模拟订单支付
export const Pay = (data) => {
	return axios.post(`/api/order/pay`, data)
}

//预生成订单
export const Submission = (data) => {
	return axios.post("/api/order/submission", data)
}
	
export const Menu = () => {
	return axios.get("/api/index/home_menu")
}
// 签到
export const User_sign = () => {
	return axios.post("/api/signlog/user_sign")
}

//获取省市级数据
export const get_area = (data) => {
	return axios.get(`/api/user/get_area_params?province=${data.province}&city=${data.city}`)
}

//获取地址列表
export const get_address_list = () => {
	return axios.post("/api/user/address")
}

//新增地址
export const add_address = (data) => {
	return axios.post("/api/user/add_address", data)
}
//删除地址
export const address_del = (data) => {
	return axios.post("/api/user/address_del", data)
}
// 下单
export const generate = (data) => {
	return axios.post("/api/order/generate", data)
}
// 我的订单列表
export const order_list = (data) => {
	return axios.post("/api/order/order_list", data)
}
// 优惠券
export const coupons = () => {
	return axios.post("/api/coupons/index")
}
// 我的优惠券
export const mycoupons = () => {
	return axios.post("/api/coupons/my_coupons")
}
// 领取优惠券
export const receive = (data) => {
	return axios.post("/api/coupons/receive", data)
}
// 上传身份证
export const upload_card = (data) => {
	return axios.post("/api/user/upload_card", data)
}
// 订单详情
export const order_info = (data) => {
	return axios.post("/api/order/order_info", data)
}
// 获取店铺列表
export const shop_list = (data) => {
	return axios.get("/api/shop/shop_list",data)
}
// 获取店铺详情
export const shop_info = (data) => {
	return axios.post("/api/shop/shop_info", data)
}